package io.babystar.modules.business.service.impl;

import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.babystar.common.utils.PageUtils;
import io.babystar.common.utils.Query;

import io.babystar.modules.business.dao.BaseMemberCardDao;
import io.babystar.modules.business.entity.BaseMemberCardEntity;
import io.babystar.modules.business.service.BaseMemberCardService;


@Service("baseMemberCardService")
public class BaseMemberCardServiceImpl extends ServiceImpl<BaseMemberCardDao, BaseMemberCardEntity> implements BaseMemberCardService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<BaseMemberCardEntity> page = this.page(
                new Query<BaseMemberCardEntity>().getPage(params),
                new QueryWrapper<BaseMemberCardEntity>().eq("organize_id",params.get("business_id"))
        );

        return new PageUtils(page);
    }

    /**
     * 查询会员卡状态
     * @return
     */
    @Override
    public List<BaseMemberCardEntity> getMemberCard(Integer organizeId){
        return this.baseMapper.getMemberCard(organizeId);
    }

}